package java_thinking.unit_12;

/**
 * @Description :
 * @author: cww
 * @DateTime: 2019-03-20 21:51
 */

class SimpleException extends Exception {
    public SimpleException(String errorMsg){
        super(errorMsg);
    }
}

class InheritingException {
    public void f() throws SimpleException{
        System.out.println("Throw simpleException demo");
        throw new SimpleException("一个报错");
    }

    public static void main(String[] args) {
        InheritingException ih = new InheritingException();
        try{
            ih.f();
        }catch (SimpleException e){
            System.out.println("Caught it!");
            System.out.println(e.getMessage());
            e.printStackTrace();
        }
    }
}